<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String base = request.getContextPath();
    request.setAttribute("base", base);
%>
<!doctype html>
<html lang="zh" class="pu">

<head>
    <!-- meta -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <!-- js -->
    <script src="${base}/resources/js/zepto.min.js"></script>
    <script src="${base}/resources/js/cookie_hold.js"></script>
    <script src="${base}/resources/js/waiting.js?78675622"></script>
    <script src="${base}/resources/js/checkstate.js"></script>

    <!-- style -->
    <style>
        .divitem {
            width: 90%;
            margin-left: 5%;
            font-size: 0px;
            color: #BBB;
            padding-top: 3%;
            padding-bottom: 3%;
            border-bottom: solid 1px #999;
        }
        .divitem button {
            border: 0px;
            padding: 0px;
            margin: 0px;
            border-radius: 0px;
            vertical-align: middle;
            color: #555;
            background: rgba(0,0,0,0);
        }
    </style>

    <title>领取记录</title>
</head>

<body style="padding: 0px;margin: 0px;">
<c:if test="${etype!='iphone'}">
    <div id="div_bar" style="position:fixed; top:0;width: 100%;height:40px;background: #333;">
        <span id="div_return" style="width:100%;text-align: left;height: 100%;vertical-align:middle;padding-left: 3%; color: #FFF;">返回</span>
    </div>
</c:if>

<!-- blank -->
<div id="div_blank"></div>
<c:if test="${withdraws.size()==0}">
    <div id="div_none" style="width: 100%;text-align: center;color: #AAA;margin-top: 3%;">暂无领取记录</div>
</c:if>

<!-- list -->
<div id="withdrawlist" style="width:100%;height:100px;margin-top: 0px;">
    <c:forEach items="${withdraws}" var="withdraw" varStatus="us">
        <div class="divitem">
            <button style="width:70%;text-align: left;">领取红包${withdraw.withdrawMoney}，扣除菲币${withdraw.withdrawPropConsume}</button>
            <c:if test="${withdraw.status==1}">
                <button style="width:30%;text-align: right;color: #F00;">待审核</button>
            </c:if>
            <c:if test="${withdraw.status==2}">
                <button style="width:30%;text-align: right;color: #F00;">审核中</button>
            </c:if>
            <c:if test="${withdraw.status==4}">
                <button style="width:30%;text-align: right;color: #F00;">审核未通过</button>
            </c:if>
            <c:if test="${withdraw.status==3}">
                <button style="width:30%;text-align: right;">${withdraw.verifyPassDay}</button>
            </c:if>
        </div>
    </c:forEach>
</div>

</body>

<!-- javascript -->
<script>
    //查询页面参数
    var pagenum = 2;
    var pagesize = 10;
    var loading = false;

    $(document).ready(function(){
        //滚动响应
        $(window).scroll(run_loading);

        //返回
        $('#div_return').click (function(){
            history.back();
        });

        //计算显示尺寸
        countRect();
        $(window).resize(function () {
            countRect();
        });
    });

    function run_loading() {
        var top = $(window).scrollTop();
        var height = $(window).height();
        var vheight = $(document).height();
        //
        if (window.fx - top > 0){
            return;
        }
        //
        if (top > vheight - height - 1) {
            window.fx = top;
            loadHtml();
        }
    }

    function loadHtml() {
        if(loading) return;
        loading=true;

        $.waiting.show("加载中...", "20px", "bottom");
        $.ajax({
            url: "${base}/withdraw/list_page.htm?uid=${uid}&pagenum=" + pagenum + "&pagesize=" + pagesize,
            data: null,
            type: "post",
            datatype: "json",
            success: function (data) {
                $.waiting.hide();
                loading=false;
                if (data.toString().length < 500) {
                    $.tips("已达最底部", "20px", "bottom");
                    return;
                }

                //异步提现记录
                var withdraw_list = $("#withdrawlist");
                $(data).appendTo(withdraw_list);
                pagenum ++;
            },
            error: function () {
//                $.waiting.hide();
                loading = false;
            }
        });
    }

    function countRect () {
        //
        var ww,wh,fsz;
        ww = parseInt ($(window).width());
        wh = parseInt ($(window).height())
        fsz = ww * 0.04;
        $('.divitem button').css('font-size', fsz);
        $('#div_none').css('font-size', fsz);
        $('#div_return').css('font-size', wh * 0.03);
        $('#div_bar').css('height', wh * 0.06);
        $('#div_blank').css('margin-top', wh * 0.07);
    }
</script>

</html>